var subsets = function(nums) {
    const ans = [[]]
    const dfs = function(index,temp) {
      if(index===nums.length) {
        return
      }
      for(var i=index;i<nums.length;i++) {
        temp.push(nums[i])
        ans.push([...temp])
        dfs(i+1,[...temp])
        temp.pop()
      } 
    }
    dfs(0,[])
    return ans
};
// console.log(subsets([1,2,3]));
console.log([1,2]==[1,2]);
